import request from '@/utils/request'

function url(u) {
  const prefix = '/message'
  return `${prefix}${u || ''}`
}

export function findMessage() {
  return request({
    url: url(),
    method: 'get',
    params: { isRead: 1 }
  })
}

export function readedMessage() {
  return request({
    url: url(),
    method: 'get',
    params: { isRead: 0 }
  })
}

export function readMessage(id) {
  return request({
    url: url(`/${id}`),
    method: 'put'
  })
}
